package leetcode;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2022-02-02 18:25
 **/
public class LeetCode2000 {

    public String reversePrefix(String word, char ch) {
        int i = word.indexOf(ch);
        StringBuilder builder = new StringBuilder();
        int j = i;
        while (j >= 0) {
            builder.append(word.charAt(j));
            --j;
        }
        builder.append(word.substring(i + 1));
        return builder.toString();
    }

}
